<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>内容编辑</title>
		<jsp:include page="/_loadCssScript.jsp"/>
		<style type="text/css">
			input {
				width: 300px;
			}
		</style>
		<script type="text/javascript">
			$(function(){
				
				$("#tabs").tabs({
					active: 1,
					disabled: [ 0 ]
				});
				$("button").button();
				
				var sendDate = $(":input[name='sendDate']");
				sendDate.datepicker();
				sendDate.datepicker("option","dateFormat","yy-mm-dd");
				
				$("form:first").validate({
					submitHandler: function(form){
						form.submit();
					},
					rules: {
						name:{
							required: true,
						    maxlength: 50
						},
						sendDate:{
							dateISO: true
						}
					}
				});
				$("#saveBtn").click(function(){
					$("form:first").submit();
				});
				
			});
		</script>
	</head>
	<body>
		<div id="tabs">
			<ul>
		        <li><a href="#tabs-1">浏览查询</a></li>
		        <li><a href="#tabs-2">内容编辑</a></li>
		    </ul>
		    <div id="tabs-1">
		    </div>
		    <div id="tabs-2">
		    	<button onclick="location.href='${fromUrl}'">&lt; 返回</button>
		    	<button id="saveBtn" type="button">√ 保存</button>
		    	
		    	<div class="clear_both"></div>
		    	
		    	<!-- 手机预览 -->
		    	<div id="previewDiv">
		    		<div id="smsbgDiv"></div>
		    		<div id="phoneDiv"></div>
		    		<div id="contentDiv">
		    			<c:if test="${frames != null }">
		    				<c:forEach items="${frames }" var="row" varStatus="status">
		    					<c:if test="${row.imageUri != null && row.imageUri != '' }">
		    						<p><img alt="" src="${row.imageUri }"/></p>
		    					</c:if>
		    					<c:if test="${row.text != null }">
		    						<p>${row.text }</p>
		    					</c:if>
		    					<center>[第${status.index + 1 }帧]</center>
		    					<hr />
		    				</c:forEach>
		    			</c:if>
		    		</div>
		    	</div>
		    	
		    	<div>
					<form action="<%=request.getContextPath() %>/module/mms/modify.do" method="post">
						<input type="hidden" name="id" value="${mms.id }" />
						<input type="hidden" name="fromUrl" value="${fromUrl }" />
						<fieldset>
							<legend>内容基本信息</legend>
							<table>
								<tr>
									<th class="ui-widget-header"><label>内容名称：</label></th>
									<td><input type="text" name="name" value="${mms.name }"/></td>
								</tr>
								<tr>
									<th class="ui-widget-header"><label>关键字：</label></th>
									<td><input type="text" name="keyWord" value="${mms.keyWord }"/></td>
								</tr>
								<tr>
									<th class="ui-widget-header"><label>所属分类：</label></th>
									<td><input type="text" name="contentCategoryId" value="${mms.contentCategoryId }"/></td>
								</tr>
								<tr>
									<th class="ui-widget-header"><label>内容编号：</label></th>
									<td><input type="text" name="number" value="${mms.number }"/></td>
								</tr>
							</table>
						</fieldset>
						<fieldset>
							<legend>内容详细信息</legend>
							<table cellspacing="0">
								<tr>
									<th class="ui-widget-header"><label>彩信主题：</label></th>
									<td><input type="text" name="mmsTopic" value="${mms.mmsTopic }"/></td>
								</tr>
								<tr>
									<th class="ui-widget-header"><label>彩信编号：</label></th>
									<td><input type="text" name="mmsNumber" value="${mms.mmsNumber }" /></td>
								</tr>
								<tr>
									<th class="ui-widget-header"><label>回访URL地址：</label></th>
									<td><input type="text" name="callbackUrl" value="${mms.callbackUrl }" /></td>
								</tr>
								<tr>
									<th class="ui-widget-header"><label>URL地址所在帧：</label></th>
									<td><input type="text" name="callbackUrlFrame" value="${mms.callbackUrlFrame }" /></td>
								</tr>
								<tr>
									<th class="ui-widget-header"><label>发送日期：</label></th>
									<td><input type="text" name="sendDate" value="" /></td>
								</tr>
								<tr>
									<th class="ui-widget-header"><label>内容提交时间：</label></th>
									<td><fmt:formatDate value="${mms.createdTime }" type="date" pattern="yyyy-MM-dd HH:mm:ss" /></td>
								</tr>
								<tr>
									<th class="ui-widget-header"><label>内容当前状态：</label></th>
									<td>${stateMap[mms.state] }</td>
								</tr>
							</table>
						</fieldset>
					</form>
		    	</div>
		    	
		    	<div class="clear_both"></div>
		    </div>
	    </div>
	</body>
</html>